﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Jiz.App.Domain.Services
{
    public class QueryService
    {
        public List<Datas.AdClickCount> QueryByApp(string app, string salesman, DateTime beginTime, DateTime endTime)
        {
            using(AppDbContext dbContext = new AppDbContext())
            {
                return dbContext.Database.SqlQuery<Datas.AdClickCount>("exec [app_sp_queryadclickcount] @app={0}, @begintime={1}, @endtime={2}, @salesman={3}",
                new object[] { app, beginTime, endTime, salesman }).ToList();
            }
        }

        public List<Models.MACNickname> QueryMACNicknameList()
        {
            using(AppDbContext dbContext = new AppDbContext())
            {
                return dbContext.Set<Models.MACNickname>().OrderBy(p => p.MAC).ToList();
            }
        }
    }
}
